package xupt.se.ttms.service;

import java.sql.ResultSet;
import java.util.List;
import xupt.se.ttms.idao.DAOFactory;
import xupt.se.ttms.idao.iStudioDAO;
import xupt.se.ttms.model.Studio;

public class StudioSrv {
	private iStudioDAO stuDAO=DAOFactory.creatStudioDAO();
	
	public boolean add(Studio studio) throws Exception{
		
			return stuDAO.execInsert(studio);
	}
	
	public boolean modify(Studio stu) throws Exception{
		return stuDAO.execUpdate(stu); 		
	}
	
	public boolean delete(int ID) throws Exception{
		return stuDAO.execDelete(ID);		
	}
	
	public List<Studio> Fetch(Integer id) throws Exception{
		ResultSet resultSet=stuDAO.execQuery(id);
		return stuDAO.HandleStudioResultSet(resultSet);	
	}
	public List<Studio> Fetch(String condt) throws Exception{
		ResultSet resultSet=stuDAO.execQuery(condt);	
		return stuDAO.HandleStudioResultSet(resultSet);	
	}
	
	public List<Studio> FetchSmall(int seat_number) throws Exception
	{
		ResultSet resultSet=stuDAO.execQuerySmall(seat_number);
		return stuDAO.HandleStudioResultSet(resultSet);		
	}
	public List<Studio> FetchBig(int seat_number) throws Exception
	{
		ResultSet resultSet=stuDAO.execQueryBig(seat_number);
		return stuDAO.HandleStudioResultSet(resultSet);		
	}
	public List<Studio> FetchAll() throws Exception{
		ResultSet resultSet=stuDAO.exexQueryAll();
		return stuDAO.HandleStudioResultSet(resultSet);			
	}
}
